package com.ruoyi.business.service.impl;

import com.ruoyi.common.utils.SecurityUtils;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.BusOrderMapper;
import com.ruoyi.business.domain.BusOrder;
import com.ruoyi.business.service.IBusOrderService;

/**
 * 订单Service业务层处理
 *
 * @author lzq
 * @date 2022-10-22
 */
@Service
public class BusOrderServiceImpl implements IBusOrderService
{
    @Autowired
    private BusOrderMapper busOrderMapper;

    /**
     * 查询订单
     *
     * @param id 订单主键
     * @return 订单
     */
    @Override
    public BusOrder selectBusOrderById(Long id)
    {
        return busOrderMapper.selectBusOrderById(id);
    }

    /**
     * 查询订单列表
     *
     * @param busOrder 订单
     * @return 订单
     */
    @Override
    public List<BusOrder> selectBusOrderList(BusOrder busOrder)
    {
        return busOrderMapper.selectBusOrderList(busOrder);
    }

    /**
     * 新增订单
     *
     * @param busOrder 订单
     * @return 结果
     */
    @Override
    public int insertBusOrder(BusOrder busOrder)
    {
        busOrder.setCreateBy(SecurityUtils.getUsername());
        busOrder.setCreateTime(DateUtils.getNowDate());
        return busOrderMapper.insertBusOrder(busOrder);
    }

    /**
     * 修改订单
     *
     * @param busOrder 订单
     * @return 结果
     */
    @Override
    public int updateBusOrder(BusOrder busOrder)
    {
        busOrder.setUpdateBy(SecurityUtils.getUsername());
        busOrder.setUpdateTime(DateUtils.getNowDate());
        return busOrderMapper.updateBusOrder(busOrder);
    }

    /**
     * 批量删除订单
     *
     * @param ids 需要删除的订单主键
     * @return 结果
     */
    @Override
    public int deleteBusOrderByIds(Long[] ids)
    {
        return busOrderMapper.deleteBusOrderByIds(ids);
    }

    /**
     * 删除订单信息
     *
     * @param id 订单主键
     * @return 结果
     */
    @Override
    public int deleteBusOrderById(Long id)
    {
        return busOrderMapper.deleteBusOrderById(id);
    }
}
